<template>
  <div class="component-lang flash" v-for="item in lang" :key="item.id" @click="setLang(item.code)">
    <div class="dot" v-if="$i18n.locale == item.code"></div> {{ item.name }}
  </div>
</template>

<script>
import app from '@/app'

export default {
  setup() {
    return {
      lang: app.lang.list,

      // 设置语言
      setLang(code) {
        app.lang.set(code)
      }
    }
  }
}
</script>